/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: LXW
 * Date: 2022-04-08
 * Time: 21:23
 */
class singleton1 {
    private singleton1 instance = new singleton1();
    public singleton1 getInstance() {
        return instance;
    }
}
class singleton2 {
    private singleton2 instance = null;
    public singleton2 getInstance() {
        if(instance == null) {
            synchronized(this) {
                if(instance == null) {
                    instance = new singleton2();
                }
            }
        }
        return instance;
    }
}
public class Demo1 {
    public static void main(String[] args) {

    }
}
